import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:flutter/material.dart';

///input输入框类型
class InputWidget {
  ///标题输入框
  static Widget titleInput({
    String? title,
    TextEditingController? controller,
    String? hintText,
    TextStyle? hintStyle,
    TextStyle? style,
    bool? signVisible,
  }) {
    return Container(
      decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(width: ScreenUtil().L(1), color: KColorConstant.lineE2E5E8))),
      child: Row(
        children: [
          Visibility(visible: signVisible ?? true, child: Text("*", style: KFontConstant.myTextStyle(size: 15, color: Colors.red))),
          Text(title ?? "", style: KFontConstant.myTextStyle(size: 17)),
          Container(width: ScreenUtil().L(20)),
          Expanded(
            child: TextField(
              controller: controller,
              style: style ?? KFontConstant.myTextStyle(size: 17),
              showCursor: true,
              decoration: InputDecoration(
                hintText: hintText ?? "",
                hintStyle: hintStyle ?? KFontConstant.myTextStyle(size: 17, color: KColorConstant.hintTextColor),
                border: InputBorder.none,
              ),
            ),
          )
        ],
      ),
    );
  }

  ///标题选择框
  static Widget selectInput({
    String? title,
    TextEditingController? controller,
    String? hintText,
    TextStyle? hintStyle,
    TextStyle? style,
    bool? signVisible,
  }) {
    return Container(
      decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(width: ScreenUtil().L(1), color: KColorConstant.lineE2E5E8))),
      child: Row(
        children: [
          Visibility(visible: signVisible ?? true, child: Text("*", style: KFontConstant.myTextStyle(size: 15, color: Colors.red))),
          Container(width: ScreenUtil().L(5)),
          Text(title ?? "", style: KFontConstant.myTextStyle(size: 17)),
          Container(width: ScreenUtil().L(20)),
          Expanded(
            child: TextField(
              controller: controller,
              style: style ?? KFontConstant.myTextStyle(size: 17),
              showCursor: true,
              decoration: InputDecoration(
                  hintText: hintText ?? "",
                  hintStyle: hintStyle ?? KFontConstant.myTextStyle(size: 17, color: KColorConstant.hintTextColor),
                  border: InputBorder.none,
                  enabled: true),
            ),
          )
        ],
      ),
    );
  }
}
